#ifndef TILESET_H
#define TILESET_H

#include "tile.h"

#include <qstring.h>
#include <qfile.h>

class Tileset
{
public:
    Tileset(const QString& imagePath, const QString& propPath, const QString& name = "Undefined",
            sf::Uint8 tilesWidth = 32, sf::Uint8 tilesHeight = 32);
    virtual ~Tileset();

    void saveProps();
    void readProps();

    //Sets the type of the (y,x) tile
    void modifyProps(quint8 x, quint8 y, TileType type);
    void fillProps(TileType value);

    const QString& getName() const;
    const Tile& getTile(quint8 x, quint8 y) const;
    const Tile& getTile(quint16 n) const;
    quint8 getWidth() const;
    quint8 getHeight() const;
    quint16 getNum(quint8 x, quint8 y) const;

    const SpriteRef& getSpriteRef() const;

private:
    SpriteRef m_spriteRef;

    QFile m_propFile;
    QString m_name;

    quint8 m_width;
    quint8 m_height;
    quint8 m_tilesWidth;
    quint8 m_tilesHeight;
    Tile*** m_tiles;
};

#endif // TILESET_H
